using System;
using System.Collections.Generic;
using System.Text;
using Decav.Data;

namespace Decav.Gatsb.Messaging
{
    public class InboxMessage
    {
        public InboxMessage()
        {
        }

        protected InboxMessage(DataRecordAdapter adapt)
        {
            if (adapt == null)
                throw new ArgumentNullException("adapt");        

            _type = (MessageType)adapt.GetInt32("Type");
            _sendDate = adapt.GetDateTime("DateSent");
            _body = adapt.GetString("Body");
            _subject = adapt.GetString("Subject");
            _sender = adapt.GetGuid("SenderUserId");
        }

        private MessageType _type;
        private DateTime _sendDate;
        private string _subject;
        private string _body;
        private Guid _sender;

        /// <summary>
        /// Gets the status of the message.
        /// </summary>
        public MessageStatus Status
        {
            get
            {
                return MessageStatus.Unread;
            }
        }

        /// <summary>
        /// Gets the message type.
        /// </summary>
        public MessageType Type
        {
            get
            {
                return _type;
            }
        }

        /// <summary>
        /// Gets the date the message was sent
        /// </summary>
        public DateTime SendDate
        {
            get
            {
                return _sendDate;
            }
        }

        /// <summary>
        /// Gets the subject of the message.
        /// </summary>
        public string Subject
        {
            get
            {
                return _subject;
            }
        }

        /// <summary>
        /// Gets the body of the message.
        /// </summary>
        public string Body
        {
            get
            {
                return _body;
            }
        }

        /// <summary>
        /// Gets the person sending the message.
        /// </summary>
        public Guid SenderId
        {
            get
            {
                return _sender;
            }
        }

    }
}
